//
//  Constants.h
//  DiveCalcsApp
//
//  Created by Donald MacKay on 11-04-07.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

long const kRatioDecoMetricSP           = 45;
long const kRatioDecoImperialSP         = 150;
float const kRatioDecoAscTimePerFoot    = 0.5f;
float const kRatioDecoAscTimePerMeter   = 1.67f;


float const kFirstAscRateChange   = 0.75;
float const kSecondAscRateChange  = 0.50;
float const kThirdAscRateChange   = 0.25;

// Formatted Strings for the Dive Profile
NSString *const kMinGasText         = @"The Minimum Gas for this dive is: %d %@.";
NSString *const kCNSText            = @"The total CNS acumulation is %1.2f%%.";
NSString *const kOTUText            = @"The total OTUs is %d.";

NSString *const kUnadjustedDecoText = @"The unadjusted deco for this dive is %d minutes.";
NSString *const kLastStopText       = @"Final stop time is at %d %@ for %d min.";
NSString *const kDecoStopsText      = @"Deco stop at %d %@ for %d min.";
NSString *const kMidAscText         = @"Ascent from %d %@ to %d %@ is %1.0f min. ";
NSString *const kInitialAscText     = @"Ascent from %d %@ to %d %@ is %1.0f min.";

NSString *const kMetricTag      = @"Meters";
NSString *const kLitersTag      = @"Liters";
NSString *const kImperialTag    = @"Feet";
NSString *const kCubicFeetTag    = @"cuft";

/**
 * Constantants used for selection of the correct 
 *  standard gas
 */
float const k32percent  =   0.32;
float const k21percent  =   0.21;
float const k18percent  =   0.18;
float const k15percent  =   0.15;
float const k12percent  =   0.12;
float const k10percent  =   0.10;// Default for depths greater than 90m

// Meters
int const k32percentMOD_M =   30;
int const k21percentMOD_M =   45;
int const k18percentMOD_M =   60;
int const k15percentMOD_M =   75;
int const k12percentMOD_M =   90;
int const k10percentMOD_M =   110; // Default for depths greater than 90m

// Meters
int const k32percentMOD_I =   100;
int const k21percentMOD_I =   150;
int const k18percentMOD_I =   200;
int const k15percentMOD_I =   250;
int const k12percentMOD_I =   300;
int const k10percentMOD_I =   330; // Default for depths greater than 90m

NSString *const k32percentText  =   @"32%%";
NSString *const k21percentText  =   @"21/35";
NSString *const k18percentText  =   @"18/45";
NSString *const k15percentText  =   @"15/55";
NSString *const k12percentText  =   @"12/65";
NSString *const k10percentText  =   @"10/70";

/***
 * Pressure measurements
 */
const double kN2PressureInBar = 0.79;
const double kN2PressureInMSW = 7.9;

/*****
 *  If we use standard values of PCO2 = 40 mm Hg and PH20 = 47 mm Hg, then for the following
 *  respiratory quotients we get:
 *  Rq = 0.8            0.9                 1.0
 *  ----------------    ------------------  ---------------
 *  Pamb - 37 mm Hg     Pamb - 42.55 mm Hg  Pamb - 47 mm Hg
 *  Pamb - 0.0493 bar   Pamb - 0.0567 bar   Pamb - 0.0627 bar
 *  Pamb - 0.493 msw    Pamb - 0.567 msw    Pamb - 0.627 msw
 *  Pamb - 1.607 fsw    Pamb - 1.848 fsw    Pamb - 2.041 fsw
 *  (Schreiner value)   (U.S. Navy value)   (Bühlmann value)
 */
const double kSchreinerWVPInMSW = 0.493;
const double kSchreinerWVPInFSW = 1.607;
const double kUSNWVPInMSW = 0.567;
const double kUSNWVPInFSW = 1.848;
const double kBuhlmannWVPInMSW = 0.627;
const double kBuhlmannWVPInFSW = 2.041;

const double kWaterVaporPressureFSW = 2.041;
/* Helper constant contains adjusted ppN2 at sea level */
const double kppN2AtSeaLevelInBar = ((1 - (kBuhlmannWVPInMSW/10)) * kN2PressureInBar);
const int kNumberOfCompartments = 16;

/***
 * Halflife constants for Nitrogen
 */
double const kHalfLifeN2Cmp0    = 5.0;
double const kHalfLifeN2Cmp1    = 8.0;
double const kHalfLifeN2Cmp2    = 12.5;
double const kHalfLifeN2Cmp3    = 18.5;
double const kHalfLifeN2Cmp4    = 27.0;
double const kHalfLifeN2Cmp5    = 38.3;
double const kHalfLifeN2Cmp6    = 54.3;
double const kHalfLifeN2Cmp7    = 77.0;
double const kHalfLifeN2Cmp8    = 109.0;
double const kHalfLifeN2Cmp9    = 146.0;
double const kHalfLifeN2Cmp10   = 187.0;
double const kHalfLifeN2Cmp11   = 239.0;
double const kHalfLifeN2Cmp12   = 305.0;
double const kHalfLifeN2Cmp13   = 390.0;
double const kHalfLifeN2Cmp14   = 498.0;
double const kHalfLifeN2Cmp15   = 635.0;

/***
 * Halflife constants for Helium
 */
double const kHalfLifeHeCmp0    = 1.88;
double const kHalfLifeHeCmp1    = 3.02;
double const kHalfLifeHeCmp2    = 4.72;
double const kHalfLifeHeCmp3    = 6.99;
double const kHalfLifeHeCmp4    = 10.21;
double const kHalfLifeHeCmp5    = 14.48;
double const kHalfLifeHeCmp6    = 20.53;
double const kHalfLifeHeCmp7    = 29.11;
double const kHalfLifeHeCmp8    = 41.20;
double const kHalfLifeHeCmp9    = 55.19;
double const kHalfLifeHeCmp10   = 70.60;
double const kHalfLifeHeCmp11   = 90.34;
double const kHalfLifeHeCmp12   = 115.29;
double const kHalfLifeHeCmp13   = 147.42;
double const kHalfLifeHeCmp14   = 188.24;
double const kHalfLifeHeCmp15   = 240.03;

/***
 * Buhlman ZHL_16A Nitrogen a coefficients Theorectical
 */
double const kZHL_16A_N2aCmp0 = 1.2599;
double const kZHL_16A_N2aCmp1 = 1.0000;
double const kZHL_16A_N2aCmp2 = 0.8618;
double const kZHL_16A_N2aCmp3 = 0.7562;
double const kZHL_16A_N2aCmp4 = 0.6667;
double const kZHL_16A_N2aCmp5 = 0.5933;
double const kZHL_16A_N2aCmp6 = 0.5282;
double const kZHL_16A_N2aCmp7 = 0.4701;
double const kZHL_16A_N2aCmp8 = 0.4187;
double const kZHL_16A_N2aCmp9 = 0.3798;
double const kZHL_16A_N2aCmp10    = 0.3497;
double const kZHL_16A_N2aCmp11    = 0.3223;
double const kZHL_16A_N2aCmp12    = 0.2971;
double const kZHL_16A_N2aCmp13    = 0.2737;
double const kZHL_16A_N2aCmp14    = 0.2523;
double const kZHL_16A_N2aCmp15    = 0.2327;

/***
 * Buhlman ZHL_16A Nitrogen b coefficients Theorectical
 */
double const kZHL_16A_N2bCmp0 = 0.5050;
double const kZHL_16A_N2bCmp1 = 0.6514;
double const kZHL_16A_N2bCmp2 = 0.7222;
double const kZHL_16A_N2bCmp3 = 0.7725;
double const kZHL_16A_N2bCmp4 = 0.8125;
double const kZHL_16A_N2bCmp5 = 0.8434;
double const kZHL_16A_N2bCmp6 = 0.8693;
double const kZHL_16A_N2bCmp7 = 0.8910;
double const kZHL_16A_N2bCmp8 = 0.9092;
double const kZHL_16A_N2bCmp9 = 0.9222;
double const kZHL_16A_N2bCmp10    = 0.9319;
double const kZHL_16A_N2bCmp11    = 0.9403;
double const kZHL_16A_N2bCmp12    = 0.9477;
double const kZHL_16A_N2bCmp13    = 0.9544;
double const kZHL_16A_N2bCmp14    = 0.9602;
double const kZHL_16A_N2bCmp15    = 0.9653;

/***
 * Buhlman ZHL-16A Helium a coefficients Theorectical
 */
double const kZHL_16A_HeaCmp0 = 1.7435;
double const kZHL_16A_HeaCmp1 = 1.3838;
double const kZHL_16A_HeaCmp2 = 1.1925;
double const kZHL_16A_HeaCmp3 = 1.0465;
double const kZHL_16A_HeaCmp4 = 0.9226;
double const kZHL_16A_HeaCmp5 = 0.8211;
double const kZHL_16A_HeaCmp6 = 0.7309;
double const kZHL_16A_HeaCmp7 = 0.6506;
double const kZHL_16A_HeaCmp8 = 0.5794;
double const kZHL_16A_HeaCmp9 = 0.5256;
double const kZHL_16A_HeaCmp10    = 0.4840;
double const kZHL_16A_HeaCmp11    = 0.4460;
double const kZHL_16A_HeaCmp12    = 0.4112;
double const kZHL_16A_HeaCmp13    = 0.3788;
double const kZHL_16A_HeaCmp14    = 0.3492;
double const kZHL_16A_HeaCmp15    = 0.3220;

/***
 * Buhlman ZHL-16A Helium b coefficients Theorectical
 */
double const kZHL_16A_HeBCmp0 = 0.1911;
double const kZHL_16A_HeBCmp1 = 0.4295;
double const kZHL_16A_HeBCmp2 = 0.5446;
double const kZHL_16A_HeBCmp3 = 0.6265;
double const kZHL_16A_HeBCmp4 = 0.6917;
double const kZHL_16A_HeBCmp5 = 0.7420;
double const kZHL_16A_HeBCmp6 = 0.7841;
double const kZHL_16A_HeBCmp7 = 0.8195;
double const kZHL_16A_HeBCmp8 = 0.8491;
double const kZHL_16A_HeBCmp9 = 0.8703;
double const kZHL_16A_HeBCmp10 = 0.8860;
double const kZHL_16A_HeBCmp11 = 0.8997;
double const kZHL_16A_HeBCmp12 = 0.9118;
double const kZHL_16A_HeBCmp13 = 0.9226;
double const kZHL_16A_HeBCmp14 = 0.9321;
double const kZHL_16A_HeBCmp15 = 0.9404;

/***********************************************
 * Buhlman ZHL_16B Nitrogen a coefficients
 *      These are the default values for DecoPlanner
 */
double const kZHL_16B_N2aCmp0 = 1.1696;
double const kZHL_16B_N2aCmp1 = 1.0;
double const kZHL_16B_N2aCmp2 = 0.8618;
double const kZHL_16B_N2aCmp3 = 0.7562;
double const kZHL_16B_N2aCmp4 = 0.6667;
double const kZHL_16B_N2aCmp5 = 0.5600;
double const kZHL_16B_N2aCmp6 = 0.4947;
double const kZHL_16B_N2aCmp7 = 0.4500;
double const kZHL_16B_N2aCmp8 = 0.4187;
double const kZHL_16B_N2aCmp9 = 0.3798;
double const kZHL_16B_N2aCmp10    = 0.3497;
double const kZHL_16B_N2aCmp11    = 0.3223;
double const kZHL_16B_N2aCmp12    = 0.2850;
double const kZHL_16B_N2aCmp13    = 0.2737;
double const kZHL_16B_N2aCmp14    = 0.2523;
double const kZHL_16B_N2aCmp15    = 0.2327;

/***
 * Buhlman ZHL_16B Nitrogen b coefficients
 *      These are the default values for DecoPlanner
 */
/* double const kZHL_16B_N2bCmp0 = 0.5050; Buhlmn default */
double const kZHL_16B_N2bCmp0 = 0.5578;
double const kZHL_16B_N2bCmp1 = 0.6514;
double const kZHL_16B_N2bCmp2 = 0.7222;
double const kZHL_16B_N2bCmp3 = 0.7825;
double const kZHL_16B_N2bCmp4 = 0.8126;
double const kZHL_16B_N2bCmp5 = 0.8434;
double const kZHL_16B_N2bCmp6 = 0.8693;
double const kZHL_16B_N2bCmp7 = 0.891;
double const kZHL_16B_N2bCmp8 = 0.9092;
double const kZHL_16B_N2bCmp9 = 0.9222;
double const kZHL_16B_N2bCmp10    = 0.9319;
double const kZHL_16B_N2bCmp11    = 0.9403;
double const kZHL_16B_N2bCmp12    = 0.9477;
double const kZHL_16B_N2bCmp13    = 0.9544;
double const kZHL_16B_N2bCmp14    = 0.9602;
double const kZHL_16B_N2bCmp15    = 0.9653;

/***
 * Buhlman ZH-lB Helium a coefficients
 *      These are the default values for DecoPlanner
 */
/* double const kZHL_16B_HeaCmp0 = 1.7424; Buhlman default */
double const kZHL_16B_HeaCmp0 = 1.6189; /* From DecoPlanner */
double const kZHL_16B_HeaCmp1 = 1.3830;
double const kZHL_16B_HeaCmp2 = 1.1919;
double const kZHL_16B_HeaCmp3 = 1.0458;
double const kZHL_16B_HeaCmp4 = 0.9220;
double const kZHL_16B_HeaCmp5 = 0.8205;
double const kZHL_16B_HeaCmp6 = 0.7305;
double const kZHL_16B_HeaCmp7 = 0.6502;
double const kZHL_16B_HeaCmp8 = 0.5950;
double const kZHL_16B_HeaCmp9 = 0.5545;
double const kZHL_16B_HeaCmp10    = 0.5333;
double const kZHL_16B_HeaCmp11    = 0.5189;
double const kZHL_16B_HeaCmp12    = 0.5181;
double const kZHL_16B_HeaCmp13    = 0.5176;
double const kZHL_16B_HeaCmp14    = 0.5172;
double const kZHL_16B_HeaCmp15    = 0.5119;

/***
 * Buhlman ZH-lB Helium b coefficients
 *      These are the default values for DecoPlanner
 */
/* double const kZHL_16B_HebCmp0 = 0.4245; Buhlman default */
double const kZHL_16B_HebCmp0 = 0.4770; /* From DecoPlanner */
double const kZHL_16B_HebCmp1 = 0.5747;
double const kZHL_16B_HebCmp2 = 0.6527;
double const kZHL_16B_HebCmp3 = 0.7223;
double const kZHL_16B_HebCmp4 = 0.7582;
double const kZHL_16B_HebCmp5 = 0.7957;
double const kZHL_16B_HebCmp6 = 0.8279;
double const kZHL_16B_HebCmp7 = 0.8553;
double const kZHL_16B_HebCmp8 = 0.8757;
double const kZHL_16B_HebCmp9 = 0.8903;
double const kZHL_16B_HebCmp10    = 0.8997;
double const kZHL_16B_HebCmp11    = 0.9073;
double const kZHL_16B_HebCmp12    = 0.9122;
double const kZHL_16B_HebCmp13    = 0.9171;
double const kZHL_16B_HebCmp14    = 0.9217; 
double const kZHL_16B_HebCmp15    = 0.9267;

/***
 * Buhlman ZHL-16C Nitrogen a coefficients
 *      Meant for use with dive computers. Are
 *      more conservative than the B series.
 *      Need some time to track down N2 b coefficients as
 *      well as the Helium coefficients
 */
double const kZHL_16C_N2aCmp0 = 1.1696;
double const kZHL_16C_N2aCmp1 = 1.0000;
double const kZHL_16C_N2aCmp2 = 0.8618;
double const kZHL_16C_N2aCmp3 = 0.7562;
double const kZHL_16C_N2aCmp4 = 0.6667;
double const kZHL_16C_N2aCmp5 = 0.5403;
double const kZHL_16C_N2aCmp6 = 0.4410;
double const kZHL_16C_N2aCmp7 = 0.4000;
double const kZHL_16C_N2aCmp8 = 0.3750;
double const kZHL_16C_N2aCmp9 = 0.3500; 
double const kZHL_16C_N2aCmp10    = 0.3295;
double const kZHL_16C_N2aCmp11    = 0.3065;
double const kZHL_16C_N2aCmp12    = 0.2835;
double const kZHL_16C_N2aCmp13    = 0.2610;
double const kZHL_16C_N2aCmp14    = 0.2480;
double const kZHL_16C_N2aCmp15    = 0.2327;


/**
 * Contant string descriptors for filling and
 * accessing the diveProfile dictionary
 */
NSString *const kN2HalfLifeDictKey  = @"NitrgenHalfLife";
NSString *const kHeHalfLifeDictKey  = @"HeliumHalfLife";

NSString *const kZHL_l6A_N2_a_DictKey = @"ZHL_16AN2a";
NSString *const kZHL_l6A_N2_b_DictKey = @"ZHL_16NA2b";
NSString *const kZHL_l6A_He_a_DictKey = @"ZHL_16AHea";
NSString *const kZHL_16A_He_b_DictKey = @"ZHL_16AHeb";

NSString *const kZHL_l6B_N2_a_DictKey = @"ZHL_16BN2a";
NSString *const kZHL_l6B_N2_b_DictKey = @"ZHL_16BN2b";
NSString *const kZHL_l6B_He_a_DictKey = @"ZHL_16BHea";
NSString *const kZHL_16B_He_b_DictKey = @"ZHL_16BHeb";

NSString *const kZHL_l6C_N2_a_DictKey = @"ZHL_16CN2a";
NSString *const kZHL_l6C_N2_b_DictKey = @"ZHL_16CN2b";
